import Vue from 'vue'
import VueRouter, { RouteConfig } from 'vue-router'

Vue.use(VueRouter)

const routes: Array<RouteConfig> = [
  {
    path: '/',
    name: 'Chat',
    component: () => import('../views/Chat.vue')
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import('../views/Login.vue')
  },
  {
    path: '/reset_pwd',
    name: 'ResetPwd',
    component: ()=> import('../views/ResetPwd.vue')
  },
  {
    path: '/register',
    name: 'Register',
    component: ()=> import('../views/Register.vue')
  },
  {
    path: '/reg/:randstr',
    name: 'RegisterInfo',
    component: ()=> import('../views/RegisterInfo.vue')
  },
  {
    path: '/404',
    name: 'Page404',
    component: ()=> import('../views/Page404.vue')   
  },
  {
    path: '/**',
    redirect: '/404'
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
